var uniqueApplicantId = getURLParameter("uniqueApplicantId");


$(document).ready(function() {
	
	if(sessionStorage.getItem("username") ==null){
		 window.location = "satvik_login.html";
	}
	
	getData();
	
});
function getData(){
	
	$.ajax({
		 url: "FormDataController?r="+Math.random(),
	     type: "Get",
	     data: {
	    	 "flag"		 :"getDataToPrint",
	    	 "uniqueApplicantId" :uniqueApplicantId,
	     },
	     success: function(data){
	    	 console.log("data.........................",data);
	    	 
	    	 $(".saveValue").each(function(){
	    		 name = $(this).attr("name");
	    		 
	    		 $(this).replaceWith("<span id="+name+"></span>");
	    		 
	    		 $("#"+name).text(data[name]);
	    	 });
	    	 
	    	 $("#applicantImg").attr("src",data["applicantImgurl"]);
	    	
	    	 $("#SexClass").append(data["sex"]);
	    	 
	    	 var temp = "";
	    	 $.each(data["Mode_Of_Payment"],function(key,value){
					console.log(key,'......',value);
					
					if(value){
						
						$("#modeOfPayment").append(key+", ");
						
					}
					
			});
	    	 temp = $("#modeOfPayment").text();
	    	 
	    	 temp = $.trim(temp);
	    	  
	    	 temp = temp.slice(0,-1);
	    	 
	    	 $("#modeOfPayment").empty();
	    	 $("#modeOfPayment").append(temp);
	    	 $.each(data["DOCUMENT_RTO_PASSING"],function(key,value){
					if(value){
						$("#rtoDocument").append(key.replace("_"," ")+", ");
					}
					
				});
	    	 temp = $("#rtoDocument").text();

	    	 temp = $.trim(temp);
	    	  
	    	 temp = temp.slice(0,-1);
	    	 
	    	 $("#rtoDocument").empty();
	    	 $("#rtoDocument").append(temp);
	    	 $.each(data["Type_Salary"],function(key,value){
					if(value){
						$("#saleryType").append(key.replace("_"," ")+", ");
					}
					
				});
	    	 temp = $("#saleryType").text();

	    	 temp = $.trim(temp);
	    	  
	    	 temp = temp.slice(0,-1);
	    	 
	    	 $("#saleryType").empty();
	    	 $("#saleryType").append(temp);
	    	window.print();
	     },
	     error: function () {
	    	 console.log("here error");
	    	
	     },async:false,
		
	});
	
}
function camelCase(str) {
    return str.replace(/^-ms-/, "ms-").replace(/-([a-z]|[0-9])/ig, function(all, letter) {
        return (letter + "").toUpperCase();
    });
}
function getURLParameter(name) {
	return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [ , "" ])[1]
			.replace(/\+/g, '%20'))
			|| null;
}